{ INFORMATICS.MCCME.RU
  Problem statement: http://informatics.mccme.ru/moodle/mod/statements/view3.php?chapterid=237
  Verdict: Accepted
}
var a,b,c,d,e,f,g:longint;
begin
assign(input,'input.txt');
assign(output,'output.txt');
reset(input);
rewrite(output);
read(a,b,c,d,e,g,f);
dec(a,f);
dec(b,f);
dec(c,f);
dec(d,f);
dec(e,f);
dec(g,f);
dec(a,d);
dec(b,d);
dec(a,e);
dec(c,e);
dec(b,g);
dec(c,g);
write(a+b+c+d+e+f+g);
end.